import { DB_TYPES } from './dbTypes';

export const typeCastMap = {
  [DB_TYPES.BIGINT]: [
    DB_TYPES.BIGINT,
    DB_TYPES.BOOLEAN,
    DB_TYPES.CHARACTER_VARYING,
    DB_TYPES.CHARACTER,
    DB_TYPES.DOUBLE_PRECISION,
    DB_TYPES.INTEGER,
    DB_TYPES.MONEY,
    DB_TYPES.MSAR__MATHESAR_MONEY,
    DB_TYPES.MSAR__MULTICURRENCY_MONEY,
    DB_TYPES.NUMERIC,
    DB_TYPES.REAL,
    DB_TYPES.SMALLINT,
    DB_TYPES.TEXT,
  ],

  [DB_TYPES.BIT]: [
    DB_TYPES.CHARACTER_VARYING,
    DB_TYPES.CHARACTER,
    DB_TYPES.TEXT,
  ],

  [DB_TYPES.BOOLEAN]: [
    DB_TYPES.BIGINT,
    DB_TYPES.BOOLEAN,
    DB_TYPES.CHARACTER_VARYING,
    DB_TYPES.CHARACTER,
    DB_TYPES.DOUBLE_PRECISION,
    DB_TYPES.INTEGER,
    DB_TYPES.NUMERIC,
    DB_TYPES.REAL,
    DB_TYPES.SMALLINT,
    DB_TYPES.TEXT,
  ],

  [DB_TYPES.BYTEA]: [
    DB_TYPES.CHARACTER_VARYING,
    DB_TYPES.CHARACTER,
    DB_TYPES.TEXT,
  ],

  [DB_TYPES.CHAR]: [
    DB_TYPES.CHARACTER_VARYING,
    DB_TYPES.CHARACTER,
    DB_TYPES.TEXT,
  ],

  [DB_TYPES.CHARACTER_VARYING]: [
    DB_TYPES.BIGINT,
    DB_TYPES.BOOLEAN,
    DB_TYPES.CHARACTER_VARYING,
    DB_TYPES.CHARACTER,
    DB_TYPES.DATE,
    DB_TYPES.DOUBLE_PRECISION,
    DB_TYPES.INTEGER,
    DB_TYPES.INTERVAL,
    DB_TYPES.JSON,
    DB_TYPES.JSONB,
    DB_TYPES.MONEY,
    DB_TYPES.MSAR__EMAIL,
    DB_TYPES.MSAR__MATHESAR_JSON_ARRAY,
    DB_TYPES.MSAR__MATHESAR_JSON_OBJECT,
    DB_TYPES.MSAR__MATHESAR_MONEY,
    DB_TYPES.MSAR__MULTICURRENCY_MONEY,
    DB_TYPES.MSAR__URI,
    DB_TYPES.NUMERIC,
    DB_TYPES.REAL,
    DB_TYPES.SMALLINT,
    DB_TYPES.TEXT,
    DB_TYPES.TIME_WITH_TZ,
    DB_TYPES.TIME_WITHOUT_TZ,
    DB_TYPES.TIMESTAMP_WITH_TZ,
    DB_TYPES.TIMESTAMP_WITHOUT_TZ,
  ],

  [DB_TYPES.CHARACTER]: [
    DB_TYPES.BIGINT,
    DB_TYPES.BOOLEAN,
    DB_TYPES.CHARACTER_VARYING,
    DB_TYPES.CHARACTER,
    DB_TYPES.DATE,
    DB_TYPES.DOUBLE_PRECISION,
    DB_TYPES.INTEGER,
    DB_TYPES.INTERVAL,
    DB_TYPES.JSON,
    DB_TYPES.JSONB,
    DB_TYPES.MONEY,
    DB_TYPES.MSAR__EMAIL,
    DB_TYPES.MSAR__MATHESAR_JSON_ARRAY,
    DB_TYPES.MSAR__MATHESAR_JSON_OBJECT,
    DB_TYPES.MSAR__MATHESAR_MONEY,
    DB_TYPES.MSAR__MULTICURRENCY_MONEY,
    DB_TYPES.MSAR__URI,
    DB_TYPES.NUMERIC,
    DB_TYPES.REAL,
    DB_TYPES.SMALLINT,
    DB_TYPES.TEXT,
    DB_TYPES.TIMESTAMP_WITH_TZ,
    DB_TYPES.TIMESTAMP_WITHOUT_TZ,
  ],

  [DB_TYPES.CIDR]: [
    DB_TYPES.CHARACTER_VARYING,
    DB_TYPES.CHARACTER,
    DB_TYPES.TEXT,
  ],

  [DB_TYPES.DATE]: [
    DB_TYPES.CHARACTER_VARYING,
    DB_TYPES.CHARACTER,
    DB_TYPES.DATE,
    DB_TYPES.TEXT,
    DB_TYPES.TIMESTAMP_WITHOUT_TZ,
  ],

  [DB_TYPES.DATERANGE]: [
    DB_TYPES.CHARACTER_VARYING,
    DB_TYPES.CHARACTER,
    DB_TYPES.TEXT,
  ],

  [DB_TYPES.DOUBLE_PRECISION]: [
    DB_TYPES.BIGINT,
    DB_TYPES.BOOLEAN,
    DB_TYPES.CHARACTER_VARYING,
    DB_TYPES.CHARACTER,
    DB_TYPES.DOUBLE_PRECISION,
    DB_TYPES.INTEGER,
    DB_TYPES.MONEY,
    DB_TYPES.MSAR__MATHESAR_MONEY,
    DB_TYPES.MSAR__MULTICURRENCY_MONEY,
    DB_TYPES.NUMERIC,
    DB_TYPES.REAL,
    DB_TYPES.SMALLINT,
    DB_TYPES.TEXT,
  ],

  [DB_TYPES.INET]: [
    DB_TYPES.CHARACTER_VARYING,
    DB_TYPES.CHARACTER,
    DB_TYPES.TEXT,
  ],

  [DB_TYPES.INT4RANGE]: [
    DB_TYPES.CHARACTER_VARYING,
    DB_TYPES.CHARACTER,
    DB_TYPES.TEXT,
  ],

  [DB_TYPES.INT8RANGE]: [
    DB_TYPES.CHARACTER_VARYING,
    DB_TYPES.CHARACTER,
    DB_TYPES.TEXT,
  ],

  [DB_TYPES.INTEGER]: [
    DB_TYPES.BIGINT,
    DB_TYPES.BOOLEAN,
    DB_TYPES.CHARACTER_VARYING,
    DB_TYPES.CHARACTER,
    DB_TYPES.DOUBLE_PRECISION,
    DB_TYPES.INTEGER,
    DB_TYPES.MONEY,
    DB_TYPES.MSAR__MATHESAR_MONEY,
    DB_TYPES.MSAR__MULTICURRENCY_MONEY,
    DB_TYPES.NUMERIC,
    DB_TYPES.REAL,
    DB_TYPES.SMALLINT,
    DB_TYPES.TEXT,
  ],

  [DB_TYPES.INTERVAL]: [
    DB_TYPES.CHARACTER_VARYING,
    DB_TYPES.CHARACTER,
    DB_TYPES.INTERVAL,
    DB_TYPES.TEXT,
  ],

  [DB_TYPES.JSON]: [
    DB_TYPES.CHARACTER_VARYING,
    DB_TYPES.CHARACTER,
    DB_TYPES.JSON,
    DB_TYPES.JSONB,
    DB_TYPES.MSAR__MATHESAR_JSON_ARRAY,
    DB_TYPES.MSAR__MATHESAR_JSON_OBJECT,
    DB_TYPES.TEXT,
  ],

  [DB_TYPES.JSONB]: [
    DB_TYPES.CHARACTER_VARYING,
    DB_TYPES.CHARACTER,
    DB_TYPES.JSON,
    DB_TYPES.JSONB,
    DB_TYPES.MSAR__MATHESAR_JSON_ARRAY,
    DB_TYPES.MSAR__MATHESAR_JSON_OBJECT,
    DB_TYPES.TEXT,
  ],

  [DB_TYPES.MACADDR]: [
    DB_TYPES.CHARACTER_VARYING,
    DB_TYPES.CHARACTER,
    DB_TYPES.TEXT,
  ],

  [DB_TYPES.MSAR__EMAIL]: [
    DB_TYPES.CHARACTER_VARYING,
    DB_TYPES.CHARACTER,
    DB_TYPES.MSAR__EMAIL,
    DB_TYPES.TEXT,
  ],

  [DB_TYPES.MSAR__MATHESAR_JSON_ARRAY]: [
    DB_TYPES.CHARACTER_VARYING,
    DB_TYPES.CHARACTER,
    DB_TYPES.JSON,
    DB_TYPES.JSONB,
    DB_TYPES.MSAR__MATHESAR_JSON_ARRAY,
    DB_TYPES.MSAR__MATHESAR_JSON_OBJECT,
    DB_TYPES.TEXT,
  ],

  [DB_TYPES.MSAR__MATHESAR_JSON_OBJECT]: [
    DB_TYPES.CHARACTER_VARYING,
    DB_TYPES.CHARACTER,
    DB_TYPES.JSON,
    DB_TYPES.JSONB,
    DB_TYPES.MSAR__MATHESAR_JSON_ARRAY,
    DB_TYPES.MSAR__MATHESAR_JSON_OBJECT,
    DB_TYPES.TEXT,
  ],

  [DB_TYPES.MSAR__MATHESAR_MONEY]: [
    DB_TYPES.BIGINT,
    DB_TYPES.CHARACTER_VARYING,
    DB_TYPES.CHARACTER,
    DB_TYPES.DOUBLE_PRECISION,
    DB_TYPES.INTEGER,
    DB_TYPES.MONEY,
    DB_TYPES.MSAR__MATHESAR_MONEY,
    DB_TYPES.MSAR__MULTICURRENCY_MONEY,
    DB_TYPES.NUMERIC,
    DB_TYPES.REAL,
    DB_TYPES.SMALLINT,
    DB_TYPES.TEXT,
  ],

  [DB_TYPES.MSAR__MULTICURRENCY_MONEY]: [
    DB_TYPES.CHARACTER_VARYING,
    DB_TYPES.CHARACTER,
    DB_TYPES.MSAR__MULTICURRENCY_MONEY,
    DB_TYPES.TEXT,
  ],

  [DB_TYPES.MSAR__URI]: [
    DB_TYPES.CHARACTER_VARYING,
    DB_TYPES.CHARACTER,
    DB_TYPES.MSAR__URI,
    DB_TYPES.TEXT,
  ],

  [DB_TYPES.MONEY]: [
    DB_TYPES.BIGINT,
    DB_TYPES.CHARACTER_VARYING,
    DB_TYPES.CHARACTER,
    DB_TYPES.DOUBLE_PRECISION,
    DB_TYPES.INTEGER,
    DB_TYPES.MONEY,
    DB_TYPES.MSAR__MATHESAR_MONEY,
    DB_TYPES.MSAR__MULTICURRENCY_MONEY,
    DB_TYPES.NUMERIC,
    DB_TYPES.REAL,
    DB_TYPES.SMALLINT,
    DB_TYPES.TEXT,
  ],

  [DB_TYPES.NUMERIC]: [
    DB_TYPES.BIGINT,
    DB_TYPES.BOOLEAN,
    DB_TYPES.CHARACTER_VARYING,
    DB_TYPES.CHARACTER,
    DB_TYPES.DOUBLE_PRECISION,
    DB_TYPES.INTEGER,
    DB_TYPES.MONEY,
    DB_TYPES.MSAR__MATHESAR_MONEY,
    DB_TYPES.MSAR__MULTICURRENCY_MONEY,
    DB_TYPES.NUMERIC,
    DB_TYPES.REAL,
    DB_TYPES.SMALLINT,
    DB_TYPES.TEXT,
  ],

  [DB_TYPES.NUMRANGE]: [
    DB_TYPES.CHARACTER_VARYING,
    DB_TYPES.CHARACTER,
    DB_TYPES.TEXT,
  ],

  [DB_TYPES.OID]: [
    DB_TYPES.CHARACTER_VARYING,
    DB_TYPES.CHARACTER,
    DB_TYPES.TEXT,
  ],

  [DB_TYPES.REAL]: [
    DB_TYPES.BIGINT,
    DB_TYPES.BOOLEAN,
    DB_TYPES.CHARACTER_VARYING,
    DB_TYPES.CHARACTER,
    DB_TYPES.DOUBLE_PRECISION,
    DB_TYPES.INTEGER,
    DB_TYPES.MONEY,
    DB_TYPES.MSAR__MATHESAR_MONEY,
    DB_TYPES.MSAR__MULTICURRENCY_MONEY,
    DB_TYPES.NUMERIC,
    DB_TYPES.REAL,
    DB_TYPES.SMALLINT,
    DB_TYPES.TEXT,
  ],

  [DB_TYPES.REGCLASS]: [
    DB_TYPES.CHARACTER_VARYING,
    DB_TYPES.CHARACTER,
    DB_TYPES.TEXT,
  ],

  [DB_TYPES.SMALLINT]: [
    DB_TYPES.BIGINT,
    DB_TYPES.BOOLEAN,
    DB_TYPES.CHARACTER_VARYING,
    DB_TYPES.CHARACTER,
    DB_TYPES.DOUBLE_PRECISION,
    DB_TYPES.INTEGER,
    DB_TYPES.MONEY,
    DB_TYPES.MSAR__MATHESAR_MONEY,
    DB_TYPES.MSAR__MULTICURRENCY_MONEY,
    DB_TYPES.NUMERIC,
    DB_TYPES.REAL,
    DB_TYPES.SMALLINT,
    DB_TYPES.TEXT,
  ],

  [DB_TYPES.TEXT]: [
    DB_TYPES.BIGINT,
    DB_TYPES.BOOLEAN,
    DB_TYPES.CHARACTER_VARYING,
    DB_TYPES.CHARACTER,
    DB_TYPES.DATE,
    DB_TYPES.DOUBLE_PRECISION,
    DB_TYPES.INTEGER,
    DB_TYPES.INTERVAL,
    DB_TYPES.JSON,
    DB_TYPES.JSONB,
    DB_TYPES.MONEY,
    DB_TYPES.MSAR__EMAIL,
    DB_TYPES.MSAR__MATHESAR_JSON_ARRAY,
    DB_TYPES.MSAR__MATHESAR_JSON_OBJECT,
    DB_TYPES.MSAR__MATHESAR_MONEY,
    DB_TYPES.MSAR__MULTICURRENCY_MONEY,
    DB_TYPES.MSAR__URI,
    DB_TYPES.NUMERIC,
    DB_TYPES.REAL,
    DB_TYPES.SMALLINT,
    DB_TYPES.TEXT,
    DB_TYPES.TIME_WITH_TZ,
    DB_TYPES.TIME_WITHOUT_TZ,
    DB_TYPES.TIMESTAMP_WITH_TZ,
    DB_TYPES.TIMESTAMP_WITHOUT_TZ,
  ],

  [DB_TYPES.TIME_WITH_TZ]: [
    DB_TYPES.CHARACTER_VARYING,
    DB_TYPES.CHARACTER,
    DB_TYPES.TEXT,
    DB_TYPES.TIME_WITH_TZ,
    DB_TYPES.TIME_WITHOUT_TZ,
  ],

  [DB_TYPES.TIME_WITHOUT_TZ]: [
    DB_TYPES.CHARACTER_VARYING,
    DB_TYPES.CHARACTER,
    DB_TYPES.TEXT,
    DB_TYPES.TIME_WITH_TZ,
    DB_TYPES.TIME_WITHOUT_TZ,
  ],

  [DB_TYPES.TIMESTAMP_WITH_TZ]: [
    DB_TYPES.CHARACTER_VARYING,
    DB_TYPES.CHARACTER,
    DB_TYPES.DATE,
    DB_TYPES.TEXT,
    DB_TYPES.TIMESTAMP_WITH_TZ,
    DB_TYPES.TIMESTAMP_WITHOUT_TZ,
  ],

  [DB_TYPES.TIMESTAMP_WITHOUT_TZ]: [
    DB_TYPES.CHARACTER_VARYING,
    DB_TYPES.CHARACTER,
    DB_TYPES.DATE,
    DB_TYPES.TEXT,
    DB_TYPES.TIMESTAMP_WITH_TZ,
    DB_TYPES.TIMESTAMP_WITHOUT_TZ,
  ],

  [DB_TYPES.TSRANGE]: [
    DB_TYPES.CHARACTER_VARYING,
    DB_TYPES.CHARACTER,
    DB_TYPES.TEXT,
  ],

  [DB_TYPES.TSTZRANGE]: [
    DB_TYPES.CHARACTER_VARYING,
    DB_TYPES.CHARACTER,
    DB_TYPES.TEXT,
  ],

  [DB_TYPES.TSVECTOR]: [
    DB_TYPES.CHARACTER_VARYING,
    DB_TYPES.CHARACTER,
    DB_TYPES.TEXT,
  ],

  [DB_TYPES.UUID]: [
    DB_TYPES.CHARACTER_VARYING,
    DB_TYPES.CHARACTER,
    DB_TYPES.TEXT,
  ],
};
